<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--在以下字符中统计包含“a”或“A”的字符串的个数:-->
<!--America,Greece,Britain,Canada,China,Egypt-->
<script>
    var str = ["America","Greece","Britain","Canada","China","Egypt" ];
    var count = 0;
         for (var i=0;i<str.length;i++) {
                 if (str[i].indexOf('a')!=-1||str[i].indexOf('A')!=-1){
                         count = count + 1;
                 }
             }
             alert("包含“a”或“A”的个数为："+count);

</script>
</body>
</html>